/**
 * Copyright (c) Freelens Authors. All rights reserved.
 * Copyright (c) OpenLens Authors. All rights reserved.
 * Licensed under MIT License. See LICENSE in root directory for more information.
 */

@use "../mixins";
@use "../table/table.mixins";
@use "../vars" as *;

.TableCell {
  position: relative;
  padding: $padding;
  word-break: break-all;
  overflow: hidden;
  line-height: 1.1;
  display: flex;
  align-items: center;

  &.menu {
    @include table.table-cell-action;
  }

  &.scrollable {
    @include mixins.hidden-scrollbar;
    display: flex;
    align-items: center;

    :not(:last-of-type) {
      margin-right: 0.5em;
    }
  }

  &.checkbox {
    display: flex;
    flex: 0 0 32px !important;
    padding-left: 0;
    padding-right: 0;

    &:not(.disabled) {
      cursor: pointer;
    }

    > .Checkbox {
      margin: 1px auto;
    }
  }

  &.sorting.nowrap {
    display: flex;
    align-items: center;
  }

  .sortIcon {
    transition: 150ms opacity;
    opacity: 0;
    position: absolute;
    right: 0;
    background: var(--tableHeaderBackground);

    &.enabled {
      opacity: 1;
    }
  }

  &:hover .sortIcon {
    opacity: 1;
  }

  &.sorting {
    cursor: pointer;
  }

  a {
    color: var(--primary);
    transition: 150ms color;

    &:hover {
      color: var(--textColorAccent);
    }
  }
}
